<template>
    <div>
        <div>{{name}}</div>
        <button v-on:click="onEvent">获取Vuex State变量</button>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                name: '1',
            }
        },
        name: 'HelloWorld',
        props: {
            msg: String
        },
        methods: {
            onEvent: function () {

                this.name = this.$store.state.name
                // console.log(this.$store.state.name)
            },
        },
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
